<?php

include_once './app/view/webView.php' ;
include_once './app/model/userModel.php' ;

class homeController extends Controller
{
	
	public function __construct ( )
	{
		
		parent::__construct ( ) ;
		
		$this->filter['before'] = array ( 'connection_data' => 'ALL') ;
		
	}
	
	public function connection_data ( )
	{
		
		if ( isset ( $this->session['user'] ) )
		{
				
			$this->data['logged'] = true ;
			
			$user = userModel::getById( $this->session['user']) ;
			
			$this->data['first_name'] = $user->getFirstName ( ) ;
			$this->data['last_name'] = $user->getLastName ( ) ;
			
			unset ( $user ) ;
				
		}
		else
		{
				
			$this->data['logged'] = false ;
				
		}
		
	}
	
	public function home ( )
	{
		
		$this->data['title'] = 'Accueil' ;
		$this->render ( 'webView', 'home', 'layout' ) ;
		
	}
	
	public function contact ( )
	{
		
		$this->data['title'] = 'Contact' ;
		$this->render ( 'webView', 'contact', 'layout' ) ;
		
	}
	
	public function credit ( )
	{
	
		$this->data['title'] = 'Crédit' ;
		$this->render ( 'webView', 'credit', 'layout' ) ;
	
	}
	
	public function mentions ( )
	{
	
		$this->data['title'] = 'Mentions légales' ;
		$this->render ( 'webView', 'mentions', 'layout' ) ;
	
	}
	
	public function tarifs ( )
	{
	
		$this->data['title'] = 'Tarifs' ;
		$this->render ( 'webView', 'tarifs', 'layout' ) ;
	
	}
	
}

?>